package com.heima.zhujie03;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

@Pro(classname = "com.heima.zhujie03.Dog", methodname = "eat")
public class Text {
    public static void main(String[] args) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException, InstantiationException {
       // Class<Text> textClass = Text.class;
        Class<?> aClass = Class.forName("com.heima.zhujie03.Text");

        Pro annotation = aClass.getAnnotation(Pro.class);
        String Classname = annotation.classname();
        String Methodname = annotation.methodname();


        Class className = Class.forName(Classname);
        Object o = className.getConstructor().newInstance();
        Method method = className.getMethod(Methodname);
        method.invoke(o);
    }
}
